home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 17167 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.uh.edu!pmn12564
  2. From: pmn12564@Bayou.UH.EDU (pat neff)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Using asm functions as class members!
  5. Date: 14 Apr 1996 00:32:26 GMT
  6. Organization: University of Houston
  7. Message-ID: <4kph2q$h4s@masala.cc.uh.edu>
  8. References: <4kl6ic$dr6@otis.netspace.net.au>
  9. NNTP-Posting-Host: bayou.uh.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Bill McIntosh (billmcin@netspace.net.au) wrote:
  13.  
  14.  
  15. : Ive been having a trouble trying to generate a class with
  16. : member functions that are assembly routines in external .asm files.
  17. : I want the assembler function to have access to the specific
  18. : object's data, but am not having much success.
  19.  
  20. : ie.
  21. : class test {
  22. :     int a;
  23.  
  24. :     void asmfunction();  // ???
  25. : }
  26. : so, inside the asmfunction() which is actually written TEST.ASM for
  27. :  example, I want it to be able to use 'a' properly as it's object's
  28. : data.
  29.  
  30. : Can anyone help me with this?  Im currently using a really bad hack
  31. : of calling a global c function which then calls the asm function and 
  32. : it sucks.
  33. : I am using watcom 10.5 and wasm but i dont really think this is too
  34. : relevant seeing as it is a pretty generic problem.
  35.  
  36. : Thanks!
  37. : Brett
  38. : (ps.  It would be appreciated if any answers could be mailed becuase
  39. : I dont get to read news much..)
  40.  
  41.      Welcome to C++!  Your hack is probably the only way you are going to
  42. get this to work.  In C++ names get mangled.  I have not tried to link an
  43. external asm function since my 'c' days, but when using inline assembly, any
  44. variables you want to access must be global, passed, or declared withing the
  45. function.  Granted, this is something of a speed hit most of the time, but I
  46. do not know of a way to get around it.
  47.  
  48.